//
// CANYON3 by shadrach, 2006
//
//
// Thanks Phats and the forum at the Chicken Bucket for their feedback
// Thanks to Ifurita for the best tutorials on the web and for his map-in-a-box
// Many thanks also to sock and digibob for the elevator tutorial and script section
// and to NOP for the Saberpeak water shader tutorial
// SteelRat for the forward spawn script
// Neutral Command Post prefab + script, Seven_DC
// foRza, sandwichMAN, allinosaurus, dirtdobber, sidallen
// 
// See http://www.planetwolfenstein.com/4newbies/Map_Scripting_4_Newbies.pdf for more information

game_manager
{
	spawn 
   	{		
		remapshaderflush
		
		// Game rules
		wm_axis_respawntime	20
		wm_allied_respawntime	20
		wm_number_of_objectives	8
		wm_set_round_timelimit	30

		//new objectives	
		//1 Blow up Allied Vault	
		//2 CAP Allied Docs
		//3 Capture Allied Spawn 2
		//4 Hold Forward Spawn
		//5 Capture Axis Spawn 2
		//6 Blow up Axis Vault
		//7 CAP Axis Docs		
		//8 Build Command Post
		

		// Current main objectives for each team (0=Axis, 1=Allies)
		//wm_objective_status <objective> <team (0=Axis, 1=Allies)> <status (0=neutral 1=complete 2=failed)>
		wm_objective_status 1 0 0
		wm_objective_status 1 1 0
		wm_objective_status 2 0 0
		wm_objective_status 2 1 0
		wm_objective_status 3 0 0
		wm_objective_status 3 1 0
		wm_objective_status 4 0 0
		wm_objective_status 4 1 0
		wm_objective_status 5 0 0
		wm_objective_status 5 1 0
		wm_objective_status 6 0 0
		wm_objective_status 6 1 0
		wm_objective_status 7 0 0
		wm_objective_status 7 1 0
		wm_objective_status 8 0 0
		wm_objective_status 8 1 0


		//Accum values
		accum 0 set 2 //status of forward flag
		accum 1 set 0 //Overall Allied status
		accum 2 set 0 //Overall Axis status

		// Stopwatch mode defending team (0=Axis, 1=Allies)
		wm_set_defending_team	0

		wm_setwinner	0

		wait 2000

		//setautospawn	"Forward Spawn"	1 //Uses name from description field of team_WOLF_objective
		//setautospawn	"Forward Spawn"	0
		setautospawn	"Allied Spawn 2"	1
		setautospawn	"Axis Spawn 2"	0
		
		// start triggered loops on/off as required (eg: command post radio sounds)
		disablespeaker allies_compost_sound
		disablespeaker axis_compost_sound
		
		construct axisconstruct_target
		construct alliedconstruct_target
		construct allieddam_target
		construct NEUTRAL_CONSTRUCTIBLE
		construct alliedmg_target
		
   	}

//Objective Flags

	trigger alliedobjectivecounter  //Destruction of Allied objectives
           	 	{
                 		//Set accum to increase by 1 so we know that the objective has been completed
                 		accum 1 inc 1

                       	//Call function called checkgame in game_manager to check if the round has been won
                       	trigger game_manager alliedcheckgame
           		}

	trigger axisobjectivecounter  //Destruction of Axis objectives
           	 	{
                  	//Set accum to increase by 1 so we know that the objective has been completed
                       	accum 2 inc 1

                       	//Call function called checkgame in game_manager to check if the round has been won
                       	trigger game_manager axischeckgame
           		}

	trigger alliedcheckgame // checks to see if Allied win requirements have been met
            	{
                       	accum 1 abort_if_not_equal 2
                       	wm_setwinner 1
				wait 1500
                       	wm_endround
           		}

	trigger axischeckgame // checks to see if Axis win requirements have been met
            	{
                       	accum 2 abort_if_not_equal 2
                       	wm_setwinner 0
				wait 1500
                       	wm_endround
           		}

	trigger forwardflagblue
	{
		// Change the objective state internally, so UI can update, etc.
		// Allied takes control of forward flag

		wm_objective_status	4 1 1
		wm_objective_status	4 0 2

	}

	trigger forwardflagred
	{
		// Change the objective state internally, so UI can update, etc.
		// Axis takes control of forward flag

		wm_objective_status	4 1 2
		wm_objective_status	4 0 1

	}

	trigger axisspawnblue
	{
		// Change the objective state internally, so UI can update, etc.
		// Allied takes control of axis second spawn

		// Some kind of UI pop-up to alert players
		wm_announce	"Allies capture the Axis second spawn!"

		wm_objective_status	5 1 1
		wm_objective_status	5 0 2


	}

	trigger axisspawnred
	{
		// Change the objective state internally, so UI can update, etc.
		// Axis takes control of axis second spawn

		// Some kind of UI pop-up to alert players
		wm_announce	"Axis recapture the Axis second spawn!"

		wm_objective_status	5 0 1
		wm_objective_status	5 1 2


	}

	trigger alliedspawnblue
	{
		// Change the objective state internally, so UI can update, etc.
		// Allied takes control of allied second spawn

		// Some kind of UI pop-up to alert players
		wm_announce	"Allies recapture the Allied second spawn!"

		wm_objective_status	3 1 1
		wm_objective_status	3 0 2


	}

	trigger alliedspawnred
	{
		// Change the objective state internally, so UI can update, etc.
		// Axis takes control of allied second spawn

		// Some kind of UI pop-up to alert players
		wm_announce	"Axis capture the Allied second spawn!"

		wm_objective_status	3 0 1
		wm_objective_status	3 1 2


	}


// SETS THE GAME TO NO-WINNER = DRAW IF TIMELIMIT IS HIT 
   	trigger timelimit_hit 
 	{ 
      	wm_setwinner 0
      	wm_endround 
	} 
} 

//End of Game_manager section

// FORWARD SPAWN POINT
forward_spawn
{
	spawn
	{
		wait 200
		accum 0 set 2         // Who owns flag: 0-Axis, 1-Allied 
      	accum 9 set 0         // Axis have not captures flag once yet 
      	accum 8 set 0         // Allies have not captured flag once yet 
      	setstate forwardflag_wobj invisible //remove Axis flag command map marker until captured
		remove
	}

	trigger axis_capture
	{
		trigger game_manager forwardflagred
		accum 0 abort_if_equal 0       // do Axis own flag? 
      	accum 0 set 0             // Axis own the flag 
      	wm_announce "Axis reclaim the Forward Spawn!" 

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "canyon3_axis_objcap"
		wm_teamvoiceannounce 1 "canyon3_allies_objlost"
		// *----------------------------------- vo ------------------------------------------*


      	setstate forwardflag_wobj default 
      	setautospawn "Forward Spawn"   0   // Set Axis to forward spawn 
      	alertentity forwardflag_wobj      // Switch command map marker 
      	accum 8 abort_if_equal 1         // Abort if Allies have captured flag once 
      	accum 9 abort_if_equal 1         //Abort if axis have captured flag once 
      	alertentity forwardflag_wobj 
      	accum 9 set 1               //Axis have captured at least once 
	}

	trigger allied_capture
	{
		trigger game_manager forwardflagblue
		accum 0 abort_if_equal 1       // do Allies own flag? 
      	accum 0 set 1             // Allies own the flag 
      	wm_announce "Allies capture the Forward Spawn!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "canyon3_axis_objlost"
		wm_teamvoiceannounce 1 "canyon3_allies_objcap"
		// *----------------------------------- vo ------------------------------------------*

 
      	setstate forwardflag_wobj default 
      	alertentity forwardflag_wobj   // Switch command map marker 
      	setautospawn "Forward Spawn"   1   // Set Allies to forward spawn 
      	accum 8 set 1            //Allies have captured flag at least once 
	}

}

// ALLIED SEC0ND SPAWN
allied_second_spawn
{
	spawn
	{
		wait 200
		setstate alliedspawn_wobj invisible
		accum 0 set 1
		remove
	}

	trigger axis_capture
	{
		trigger game_manager alliedspawnred

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "canyon3_axis_objcap"
		wm_teamvoiceannounce 1 "canyon3_allies_objlost"
		// *----------------------------------- vo ------------------------------------------*


		trigger allied_second_spawn setaxis
		setautospawn "Allied Spawn 2"   0   // Set Axis to allied second spawn
	}

	trigger allied_capture
	{
		trigger game_manager alliedspawnblue

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "canyon3_axis_objlost"
		wm_teamvoiceannounce 1 "canyon3_allies_objcap"
		// *----------------------------------- vo ------------------------------------------*


		trigger allied_second_spawn setallies
		setautospawn "Allied Spawn 2"   1   // Set Allies to allied second spawn
	}

	trigger setaxis
	{
		setstate alliedspawn_wobj default
		accum 0 abort_if_equal 0
		accum 0 set 0
		alertentity alliedspawn_wobj
	}

	trigger setallies
	{
		setstate alliedspawn_wobj default
		accum 0 abort_if_equal 1
		accum 0 set 1
		alertentity alliedspawn_wobj
	}
}

// AXIS SEC0ND SPAWN
axis_second_spawn
{
	spawn
	{
		wait 200
		setstate axisspawn_wobj invisible
		accum 0 set 0
		remove
	}

	trigger axis_capture
	{
		trigger game_manager axisspawnred

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "canyon3_axis_objcap"
		wm_teamvoiceannounce 1 "canyon3_allies_objlost"
		// *----------------------------------- vo ------------------------------------------*


		trigger axis_second_spawn setaxis
		setautospawn "Axis Spawn 2"   0   // Set Axis to axis second spawn
	}

	trigger allied_capture
	{
		trigger game_manager axisspawnblue

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "canyon3_axis_objlost"
		wm_teamvoiceannounce 1 "canyon3_allies_objcap"
		// *----------------------------------- vo ------------------------------------------*


		trigger axis_second_spawn setallies
		setautospawn "Axis Spawn 2"   1   // Set Allies to allied second spawn
	}

	trigger setaxis
	{
		setstate axisspawn_wobj default
		accum 0 abort_if_equal 0
		accum 0 set 0
		alertentity axisspawn_wobj
	}

	trigger setallies
	{
		setstate axisspawn_wobj default
		accum 0 abort_if_equal 1
		accum 0 set 1
		alertentity axisspawn_wobj
	}
}

// CONSTRUCTIBLE OBJECTIVES ================================================
//Axis constructible

axisconstruct_script
{ 
	spawn 
	{ 
		wait 200 
		constructible_class 2 
		trigger self startup 
	} 
	
	buildstart final 
	{ 
	} 

	built final 
	{ 
		setstate axisconstruct_target default 
		setstate axisconstruct_materials invisible 

	} 

	decayed final 
	{ 
		trigger self startup 
	} 

	death 
	{ 
		trigger self startup 
		wm_announce "The Axis Bridge has been destroyed" 

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "canyon3_axis_bridge_destroyed"
		wm_teamvoiceannounce 1 "canyon3_axis_br_destroyed"

 		// *----------------------------------- vo ------------------------------------------*

		setstate axisconstruct_materials default
	} 

	trigger startup 
	{ 
		setstate axisconstruct_target invisible
		setstate axisconstruct_materials default 
	} 
}

//allied constructible

alliedconstruct_script
{ 
	spawn 
	{ 
		wait 200 
		constructible_class 2 
		trigger self startup 
	} 
	
	buildstart final 
	{ 
	} 

	built final 
	{ 
		setstate alliedconstruct_target default
		setstate alliedconstruct_materials invisible 

	} 

	decayed final 
	{ 
		trigger self startup 
	} 

	death 
	{ 
		trigger self startup 
		wm_announce "The Axis have destroyed the Allied Bridge" 

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 1 "canyon3_allies_bridge_destroyed"
		wm_teamvoiceannounce 0 "canyon3_allies_br_destroyed"

 		// *----------------------------------- vo ------------------------------------------*

		setstate alliedconstruct_materials default
	} 

	trigger startup 
	{ 
		setstate alliedconstruct_target invisible
		setstate alliedconstruct_materials default 
	} 
}

//allied dam

allieddam_script
{ 
	spawn 
	{ 
		wait 200 
		constructible_class 3 
		trigger self startup 
	} 
	
	buildstart final 
	{ 
	} 

	built final 
	{ 
		setstate allieddam_target default
		setstate allieddam_materials invisible 

	} 

	decayed final 
	{ 
		trigger self startup 
	} 

	death 
	{ 
		trigger self startup 
		wm_announce "The Axis have destroyed the Allied Dam" 

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 1 "canyon3_allies_dam_destroyed"
		wm_teamvoiceannounce 0 "canyon3_allies_dm_destroyed"

 		// *----------------------------------- vo ------------------------------------------*

		setstate allieddam_materials default
	} 

	trigger startup 
	{ 
		setstate allieddam_target invisible
		setstate allieddam_materials default 
	} 
}

//axis gate

axisgateconstruct_script
{ 
	spawn 
	{ 
		wait 200 
		constructible_class 3 
		trigger self startup 
	} 
	
	buildstart final 
	{ 
	} 

	built final 
	{ 
		setstate axisgateconstruct_target default
		setstate axisgate_materials invisible 

	} 

	decayed final 
	{ 
		trigger self startup 
	} 

	death 
	{ 
		trigger self startup 
		wm_announce "The Allies have destroyed the Axis Gate" 

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "canyon3_axis_gate_destroyed"
		wm_teamvoiceannounce 1 "canyon3_axis_gte_destroyed"

 		// *----------------------------------- vo ------------------------------------------*

		setstate axisgate_materials default
	} 

	trigger startup 
	{ 
		setstate axisgateconstruct_target invisible
		setstate axisgate_materials default 
	} 
}


// DESTRUCTIBLE OBJECTIVES ================================================

// axis tower bridge

scr_AXIS_CONSTRUCTIBLE
{
	spawn
	{
		wait 200
		trigger self setup
		constructible_class 2
	}

	trigger setup
	{
		setstate scr_AXIS_CONSTRUCTIBLE invisible
		setstate NEUTRAL_CRATES default
	}

	buildstart final
	{
		setstate scr_AXIS_CONSTRUCTIBLE underconstruction
		setstate NEUTRAL_CRATES default
	}

	built final
	{
		setstate scr_AXIS_CONSTRUCTIBLE default
		setstate NEUTRAL_CRATES invisible
	}

	decayed final
	{
		trigger self setup
	}

	death
	{
		trigger self setup

		wm_announce "Tower Bridge destroyed!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "canyon3_axis_bridge_destroyed"
		wm_teamvoiceannounce 1 "canyon3_axis_br_destroyed"

 		// *----------------------------------- vo ------------------------------------------*

	}
}

// allied tower bridge

scr_ALLIED_CONSTRUCTIBLE
{
	spawn
	{
		wait 200
		trigger self setup
		constructible_class 2

	}

	trigger setup
	{
		setstate scr_ALLIED_CONSTRUCTIBLE invisible
		setstate NEUTRAL_CRATES default
	}

	buildstart final
	{
		setstate scr_ALLIED_CONSTRUCTIBLE underconstruction
		setstate NEUTRAL_CRATES default
	}

	built final
	{
		setstate scr_ALLIED_CONSTRUCTIBLE default
		setstate NEUTRAL_CRATES invisible

	}

	decayed final
	{
		trigger self setup
	}

	death
	{
		trigger self setup

		wm_announce "Tower Bridge destroyed!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 1 "canyon3_allies_bridge_destroyed"
		wm_teamvoiceannounce 0 "canyon3_allies_br_destroyed"

 		// *----------------------------------- vo ------------------------------------------*
	}
}
// **************************************************


//Tower Hatch
tower_hatch
{
	spawn 
	{
		wait 200
		set
			{
			constructible_class 1
			health "100"
			}
	}

	death 
	{
		wm_announce "The Tower Emergency Hatch has been destroyed!"

	}
}


//Allied Vault
southdoor_script
{
	spawn 
	{
		wait 200
		set
			{
			constructible_class 1
			health "100"
			}
	}

	death 
	{
	}
}

//Axis Vault
eastdoor_script
{
	spawn 
	{
		wait 200
		set
			{
			constructible_class 1
			health "100"
			}
	}

	death 
	{
	}
}

//Axis Docs. Allied team must capture and secure an Axis docs module containing critical codes
axis_docs //enter this as the scriptname value for the team_CTF_red/blueflag entity
{
	spawn
	{
	wait 200
	setstate axis_docs_captured invisible
	}

	trigger stolen

	{
	wm_announce "Allies have the docs! Allies have the docs!"
	setstate axis_docs_cm_marker invisible
	
	// *----------------------------------- vo ----*
		wm_teamvoiceannounce 0 "axis_obj_taken"
		wm_teamvoiceannounce 1 "allied_obj_taken"
	// *----------------------------------- vo ----*

	}

	trigger returned

	{
	wm_announce "The Axis have retrieved the docs"
	setstate axis_docs_cm_marker default
	
	// *----------------------------------- vo ----*
		wm_teamvoiceannounce 0 "axis_obj_returned"
		wm_teamvoiceannounce 1 "allied_obj_returned"
	// *----------------------------------- vo ----*

	}

	trigger captured

	{
	wm_announce "The Allies have secured the Axis docs!"
	setstate axis_docs_red invisible
	setstate axis_docs_captured default

	wm_objective_status 7 0 2
	wm_objective_status 7 1 1
	
	// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_obj_lost"
		wm_teamvoiceannounce 1 "allied_obj_secured"
	// *----------------------------------- vo ------------------------------------------*
	

	}

}

//Allied Docs. Axis team must capture and secure an Allied docs module containing critical codes
allied_docs //enter this as the scriptname value for the team_CTF_red/blueflag entity
{
	spawn
	{
	wait 200
	setstate allied_docs_captured invisible
	}

	trigger stolen

	{
	wm_announce "Axis have the docs! Axis have the docs!"
	setstate allied_docs_cm_marker invisible
	
	// *----------------------------------- vo ----*
		wm_teamvoiceannounce 0 "allied_obj_taken"
		wm_teamvoiceannounce 1 "axis_obj_taken"
	// *----------------------------------- vo ----*

	}

	trigger returned

	{
	wm_announce "The Allies have retrieved the docs"
	setstate allied_docs_cm_marker default
	
	// *----------------------------------- vo ----*
		wm_teamvoiceannounce 0 "allied_obj_returned"
		wm_teamvoiceannounce 1 "axis_obj_returned"
	// *----------------------------------- vo ----*

	}

	trigger captured

	{
	wm_announce "The Axis have secured the Allied docs!"
	setstate allied_docs_red invisible
	setstate allied_docs_captured default

	wm_objective_status 2 0 1
	wm_objective_status 2 1 2
	
	// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 1 "allied_obj_lost"
		wm_teamvoiceannounce 0 "axis_obj_secured"
	// *----------------------------------- vo ------------------------------------------*


	}

}

axis_objectives //enter this as the scriptname value for the single trigger_flagonly_multiples entity 
{

death
	{
		trigger game_manager alliedobjectivecounter
	}
}

allied_objectives //enter this as the scriptname value for the single trigger_flagonly_multiples entity 
{

death
	{
		trigger game_manager axisobjectivecounter
	}
}

// NEUTRAL COMMAND POST ================================================
// FROM Goldrush Thx SD!!! prefab by seven 2003 

allied_compost_built
{
	spawn
	{
		wait 400
		trigger allied_compost_built setup

		constructible_class 2
	}

	trigger setup
	{
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		sethqstatus 1 0
	}

	buildstart final
	{
		setstate allied_compost_built_model underconstruction
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible
	}

	built final
	{
		setstate allied_compost_built_model default
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible

		trigger allied_compost_built_model enable_allied_features

		enablespeaker allies_compost_sound
	}

	decayed final
	{
		setstate allied_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default
	}

	death
	{
		setstate allied_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default

		trigger allied_compost_built_model disable_allied_features

		disablespeaker allies_compost_sound
	}
}

allied_compost_built_model
{
	spawn
	{
		wait 400
		setstate allied_compost_built_model invisible
	}

	trigger enable_allied_features
	{
		setchargetimefactor 1 soldier 0.75
		setchargetimefactor 1 lieutenant 0.75
		setchargetimefactor 1 medic 0.75
		setchargetimefactor 1 engineer 0.75
		setchargetimefactor 1 covertops 0.75
		sethqstatus 1 1

		wm_announce	"Allied Command Post constructed. Charge speed increased!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed_allies"

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed"

		wm_removeteamvoiceannounce 1 "allies_hq_compost_construct"
		// *---------------------------------------------------------------------------------*

		wm_objective_status 8 0 2
		wm_objective_status 8 1 1
	}

	trigger disable_allied_features
	{
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		sethqstatus 1 0

		wm_announce	"Axis team has destroyed the Allied Command Post!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "axis_hq_compost_construct"

		wm_teamvoiceannounce 1 "allies_hq_compost_damaged"
		// *---------------------------------------------------------------------------------*

		wm_objective_status 8 0 0
		wm_objective_status 8 1 0
	}
}

axis_compost_built
{
	spawn
	{
		wait 400
		trigger axis_compost_built setup

		constructible_class 2
	}

	trigger setup
	{
		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		sethqstatus 0 0
	}

	buildstart final
	{
		setstate axis_compost_built_model underconstruction
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible
	}

	built final
	{
		setstate axis_compost_built_model default
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible

		trigger axis_compost_built_model enable_axis_features

		enablespeaker axis_compost_sound
	}

	decayed final
	{
		setstate axis_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default
	}

	death
	{
		setstate axis_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default

		trigger axis_compost_built_model disable_axis_features

		disablespeaker axis_compost_sound
	}
}

axis_compost_built_model
{
	spawn
	{
		wait 400
		setstate axis_compost_built_model invisible
	}

	trigger enable_axis_features
	{
		setchargetimefactor 0 soldier 0.75
		setchargetimefactor 0 lieutenant 0.75
		setchargetimefactor 0 medic 0.75
		setchargetimefactor 0 engineer 0.75
		setchargetimefactor 0 covertops 0.75
		sethqstatus 0 1

		wm_announce	"Axis Command Post constructed. Charge speed increased!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed"

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed_axis"

		wm_removeteamvoiceannounce 0 "axis_hq_compost_construct"
		// *---------------------------------------------------------------------------------*

		wm_objective_status 8 0 1
		wm_objective_status 8 1 2
	}

	trigger disable_axis_features
	{
		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		sethqstatus 0 0

		wm_announce	"Allied team has destroyed the Axis Command Post!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "axis_hq_compost_damaged"

		wm_teamvoiceannounce 1 "allies_hq_compost_construct"
		// *---------------------------------------------------------------------------------*

		wm_objective_status 8 0 0
		wm_objective_status 8 1 0
	}
}


//Allied MG

alliedmg_script 
{ 
	spawn 
	{ 
      		wait 200 
      		constructible_class 2 
      		trigger self startup 
   	} 

   	buildstart final 
   	{ 
   	} 

   	built final 
   	{ 
      		setstate alliedmg_extra default 
      		setstate alliedmg_mg42  default 
      		setstate alliedmg_materials invisible 
   	} 

   	decayed final 
   	{ 
      		trigger self startup 
   	} 

   	death 
   	{ 
      		trigger self startup 

      		wm_announce   "Axis team has destroyed the Allied MG nest!" 
	} 

	trigger startup 
   	{ 
		setstate alliedmg_extra invisible 
		setstate alliedmg_mg42  invisible 
		setstate alliedmg_materials default 
      	repairmg42 construction_mg42 
   	} 
} 


//Breakable windows

win1
{
    spawn
    {
        wait 200
		set
		    {
			constructible_class 1
			health "100"
		    }
    }

    death
    {
    }
}

win2
{
    spawn
    {
        wait 200
		set
		    {
			constructible_class 1
			health "100"
		    }
    }

    death
    {
    }
}

win3
{
    spawn
    {
        wait 200
		set
		    {
			constructible_class 1
			health "100"
		    }
    }

    death
    {
    }
}

win4
{
    spawn
    {
        wait 200
		set
		    {
			constructible_class 1
			health "100"
		    }
    }

    death
    {
    }
}

win5
{
    spawn
    {
		wait 200
		set
		    {
			constructible_class 1
			health "100"
		    }
    }

    death
    {
    }
}

win6
{
    spawn
    {
        wait 200
		set
		    {
			constructible_class 1
			health "100"
		    }
    }

    death
    {
    }
}

win7
{
    spawn
    {
        wait 200
		set
		    {
			constructible_class 1
			health "100"
		    }
    }

    death
    {
    }
}

win8
{
    spawn
    {
        wait 200
		set
		    {
			constructible_class 1
			health "100"
		    }
    }

    death
    {
    }
}


// -------------------------------------------------------
//
// Lift+Door Brush Scripting Example
//
// Map: tut02_lift2
// Author: Sock/djbob
// Last updated: 12-July-02
//
// -------------------------------------------------------
//------------------------------------------------------------------------------
//
// In SP the "func_inv_user" trigger brush is targeted by a "target_relay" entity.
// When the "target_relay" is used via "alertentity" it will turn the "func_inv_user" ON/OFF.
//
// In MP the "target_relay" is very hit and miss and sometimes will NOT re-enable the
// "func_inv_user" trigger brush so you are left with a broken lift.
//
// Another problem with "func_inv_user" trigger brushes is that when they are turned off
// the HINT cursor does not stop either. You do get a "Offnoise" but often you don't hear it.
//
// As the Lift uses "accum" variables for its position and direction its easier
// to use the script to determine if the "func_inv_user" trigger brushes work
// or not.
//
//------------------------------------------------------------------------------
lift01_top_trigger
{
	trigger main
	{
		trigger lift01 topfuncinv
	}
}
lift01_bot_trigger
{
	trigger main
	{
		trigger lift01 botfuncinv
	}
}
//lift01_mid_trigger
//{
//	trigger main
//	{
//		trigger lift01 midfuncinv
//	}
//}

//------------------------------------------------------------------------------
//
// Lift 1
//
// Lift and lever script_movers are all controlled from this routine.
// Due to the amount of touchfields in the lift shaft this routine can be re-entered several times.
//
//------------------------------------------------------------------------------
lift01
{
	spawn
	{
		accum 2 set 0				// Where lift is or heading (0=Up/Top, 1=Down/Bottom)
		accum 3 set 0				// Lift Moving ? (0=No, 1=Yes)
	}

	trigger topfuncinv
	{
		accum 3 abort_if_equal 1		// If lift moving, then return.
		accum 2 abort_if_equal 1		// If lift at bottom of liftshaft, then return.
		trigger lift01 checkdown		// Move lift down
	}
	trigger botfuncinv
	{
		accum 3 abort_if_equal 1		// If lift moving, then return.
		accum 2 abort_if_equal 0		// If lift at top of liftshaft, then return.
		trigger lift01 checkup			// Move lift up
	}
//	trigger midfuncinv
//	{
//		accum 3 abort_if_equal 0		// If Lift NOT moving, then return.
//		trigger lift01 checkup			// Move lift up
//		trigger lift01 checkdown		// Move lift down
//	}

	trigger checkup
	{
		accum 2 abort_if_equal 0		// Lift at bottom of lift already ?

		trigger lift01 initialup		// Is this a first time request move ?
		trigger lift01 up			// Start move lift up
	}
	trigger checkdown
	{
		accum 2 abort_if_equal 1		// Lift at top of lift already ?

		trigger lift01 initialdown		// Is this a first time request move ?
		trigger lift01 down			// Start move lift down
	}

	trigger initialup				// Started journey upwards ...
	{
		accum 3 abort_if_equal 1		// Lift already Moving ?
		accum 3 set 1				// Lift's moving ...

		trigger lift01b_button_trig doorclose	// Close top doors

		trigger lift01t_button in		// Disable BOTH button panel's, lift calling only works when lift stationary
		trigger lift01b_button in

		trigger lift01t_button lwaitgreen	// Enable lift call waiting light
	}
	trigger initialdown				// Started journey downwards ...
	{
		accum 3 abort_if_equal 1		// Lift already Moving ?
		accum 3 set 1				// Lift's moving baby ...

		trigger lift01t_button_trig doorclose	// Close top doors

		trigger lift01t_button in		// Disable BOTH button panel's, lift calling only works when lift stationary
		trigger lift01b_button in

		trigger lift01b_button lwaitgreen	// Enable lift call waiting light
	}

	trigger up					// Going up
	{
		trigger lift01_lever stop		// Stop lever first, lift will catch up.
		halt					// If the routine has been re-entered, Stop lift.
		wait 500				// A little pause before direction change
		accum 2 set 0				// Set new driection of lift
		trigger lift01_lever forward		// Move lever forward and play sound.

		stopsound				// Kill all currently playing sounds belonging to this entity only
		playsound sound\movers\elevators\elev1_start.wav
		wait 5
		playsound sound\movers\elevators\elev1_loop.wav looping forever

		trigger lift01_lever up			// Trigger the lever to move down with the elevator.
		gotomarker lift01up2 600 wait		// Move lift fast to first point
		trigger lift01t_button_trig dooropen	// Open doors ready for exit
		gotomarker lift01up1 50 deccel wait	// Slow down lift and stop at second point

		stopsound				// Kill all currently playing sounds belonging to this entity only
		playsound sound\movers\elevators\elev1_end.wav

		trigger lift01_lever stop		// Mover lever back to center.
		trigger lift01t_button lwaitred		// Switch light waiting back to red.
		trigger lift01b_button out		// Enable bottom calling button panel.
		accum 3 set 0				// Lift stopped at top
	}

	trigger down					// Going down
	{
		trigger lift01_lever stop		// Stop lever first, lift will catch up.
		halt					// If the routine has been re-entered, Stop lift.
		wait 500				// A little pause before direction change
		accum 2 set 1				// Set new driection of lift
		trigger lift01_lever backward		// Move lever backwards and play sound.

		stopsound				// Kill all currently playing sounds belonging to this entity only
		playsound sound\movers\elevators\elev1_start.wav
		wait 5
		playsound sound\movers\elevators\elev1_loop.wav looping forever

		trigger lift01_lever down		// Trigger the lever to move down with the elevator.
		gotomarker lift01down2 600 wait		// Move lift fast to first point
		trigger lift01b_button_trig dooropen	// Open doors ready for exit
		gotomarker lift01down1 50 deccel wait	// Slow down lift and stop at second point

		stopsound				// Kill all currently playing sounds belonging to this entity only
		playsound sound\movers\elevators\elev1_end.wav

		trigger lift01_lever stop		// Mover lever back to center.
		trigger lift01b_button lwaitred		// Switch light waiting back to red.
		trigger lift01t_button out		// Enable top lift calling button panel.
		accum 3 set 0				// Lift stopped at bottom
	}

}

//------------------------------------------------------------------------------
//
// Lift 1 - Lever attached to lift
//
//------------------------------------------------------------------------------
lift01_lever
{
	trigger up
	{
		gotomarker lift01lever1up2 600 wait		// Move lift fast to first point
		gotomarker lift01lever1up1 50 deccel wait	// Slow down lift and stop at second point
	}

	trigger down
	{
		gotomarker lift01lever1down2 600 wait		// Move lift fast to first point
		gotomarker lift01lever1down1 50 deccel wait	// Slow down lift and stop at second point
	}
	trigger stop						// Moves lever to center
	{
		halt
		faceangles 0 0 0 150
		playsound sound\scenaric\rocket\elev_lever.wav
	}
	trigger forward						// Moves lever forward for up routine
	{
		faceangles 30 0 0 50
		playsound sound\scenaric\rocket\elev_lever.wav

	}
	trigger backward					// Moves lever backwards for down routine
	{
		faceangles -30 0 0 50
		playsound sound\scenaric\rocket\elev_lever.wav

	}
}

//------------------------------------------------------------------------------
//
// lift01t/b_button_trig is the "target_script_trigger" entity infront of the switch entity.
// door01/02_left/right well they are the doors!
//
//------------------------------------------------------------------------------

lift01t_button_trig
{
	spawn
	{
		wait 500				// Wait for everything to settle
		trigger lift01t_button_trig dooropen	// Setup doors open
	}
	trigger main
	{
		trigger lift01 checkup			// Call lift if available
	}
	trigger dooropen
	{
		trigger door01_left open		// Open both sets of doors from one routine
		trigger door01_right open
	}
	trigger doorclose
	{
		trigger door01_left close		// Close both sets of doors from one routine
		trigger door01_right close
	}
}

lift01b_button_trig
{
	trigger main
	{
		trigger lift01 checkdown		// Call lift if available
	}
	trigger dooropen
	{
		trigger door02_left open		// Open both sets of doors from one routine
		trigger door02_right open
	}
	trigger doorclose
	{
		trigger door02_left close		// Close both sets of doors from one routine
		trigger door02_right close
	}
}

//------------------------------------------------------------------------------
//
// Lever at top of Lift 1
// The lift lights are made up from func_static entities connected to target_relay entities.
// Light set 1 - is on the button control panel. It tells the user if the panel is active or not.
// Light set 2 - is the call lift waiting light. It only works if the lift is stationary and not on the same floor as the button.
// The target_relay entities switch the func_static brushes on/off.
//
//------------------------------------------------------------------------------
lift01t_button
{
	spawn
	{
		accum 2 set 1				// Button Panel light (0=RED, 1=GREEN(def))
		accum 3 set 0				// Lift calling light (0=RED(def), 1=GREEN)

		wait 200				// Let everything settle
		trigger lift01t_button in		// Lift starts at top of lift shaft, disable top panel
	}
	trigger in
	{
		playsound sound/scenaric/general/misc_switch.wav
		gotomarker lift01t_buttonin 100 wait
		trigger lift01t_button bplightred	// Switch light to red, panel dead.
	}
	trigger out
	{
		playsound sound/scenaric/general/misc_switch.wav
		gotomarker lift01t_buttonout 100 wait
		trigger lift01t_button bplightgreen	// Switch light to green, panel alive
	}

//
// The following code for each light type is designed so that when you request a certain light
// type (eg. red/green) the correct colour is shown. It maybe a few more lines of script
// than necessary but it always works and that is more important.
//
	trigger bplightgreen
	{
		accum 2 abort_if_equal 1		// Green already ?
		alertentity lift01t_light_trig		// Switch button panel light to GREEN (default)
		accum 2 set 1
	}
	trigger bplightred
	{
		accum 2 abort_if_equal 0		// Red already ?
		alertentity lift01t_light_trig		// Switch button panel light to RED (default)
		accum 2 set 0
	}
	trigger lwaitgreen
	{
		accum 3 abort_if_equal 1		// Green already ?
		alertentity lift01t_call_light_trig	// Switch lift waiting light to GREEN
		accum 3 set 1
	}
	trigger lwaitred
	{
		accum 3 abort_if_equal 0		// Red already ?
		alertentity lift01t_call_light_trig	// Switch lift waiting light to RED (default)
		accum 3 set 0
	}
}

//------------------------------------------------------------------------------
//
// Lever at bottom of Lift 2
// The lift lights are made up from func_static entities connected to target_relay entities.
// Light set 1 - is on the button control panel. It tells the user if the panel is active or not.
// Light set 2 - is the call lift waiting light. It only works if the lift is stationary and not on the same floor as the button.
// The target_relay entities switch the func_static brushes on/off.
//
//------------------------------------------------------------------------------
lift01b_button
{
	spawn
	{
		accum 2 set 1				// Button Panel light (0=RED, 1=GREEN(def))
		accum 3 set 0				// Lift calling light (0=RED(def), 1=GREEN)
	}
	trigger in
	{
		playsound sound/scenaric/general/misc_switch.wav
		gotomarker lift01b_buttonin 100 wait
		trigger lift01b_button bplightred	// Switch light to red, panel dead.
	}
	trigger out
	{
		playsound sound/scenaric/general/misc_switch.wav
		gotomarker lift01b_buttonout 100 wait
		trigger lift01b_button bplightgreen	// Switch light to green, panel alive
	}

//
// The following code for each light type is designed so that when you request a certain light
// type (eg. red/green) the correct colour is shown. It maybe a few more lines of script
// than necessary but it always works and that is more important.
//
	trigger bplightgreen
	{
		accum 2 abort_if_equal 1		// Green already ?
		alertentity lift01b_light_trig		// Switch button panel light to GREEN (default)
		accum 2 set 1
	}
	trigger bplightred
	{
		accum 2 abort_if_equal 0		// Red already ?
		alertentity lift01b_light_trig		// Switch button panel light to RED (default)
		accum 2 set 0
	}
	trigger lwaitgreen
	{
		accum 3 abort_if_equal 1		// Green already ?
		alertentity lift01b_call_light_trig	// Switch lift waiting light to GREEN
		accum 3 set 1
	}
	trigger lwaitred
	{
		accum 3 abort_if_equal 0		// Red already ?
		alertentity lift01b_call_light_trig	// Switch lift waiting light to RED (default)
		accum 3 set 0
	}
}

//------------------------------------------------------------------------------`
//
// Upper Doors outside of Lift 1
//
//------------------------------------------------------------------------------
door01_left
{
	trigger open
	{
		wait 500
		//playsound sound\movers\misc\big_gate1.wav
		wait 400
		//playsound sound\movers\misc\big_gate2.wav looping forever
		gotomarker door01_left2 50 wait
		stopsound
		//playsound sound\movers\misc\big_gate3.wav
	}

	trigger close
	{
		wait 500
		//playsound sound\movers\misc\big_gate1.wav
		wait 400
		//playsound sound\movers\misc\big_gate2.wav looping forever
		gotomarker door01_left1 50 wait
		stopsound
		//playsound sound\movers\misc\big_gate3.wav

	}
}

door01_right
{
	trigger open
	{
		wait 500
		//playsound sound\movers\misc\big_gate1.wav

		wait 400
		//playsound sound\movers\misc\big_gate2.wav looping forever

		gotomarker door01_right2 50 wait
		stopsound
		//playsound sound\movers\misc\big_gate3.wav

	}

	trigger close
	{
		wait 500
		//playsound sound\movers\misc\big_gate1.wav
		wait 400
		//playsound sound\movers\misc\big_gate2.wav looping forever
		gotomarker door01_right1 50 wait
		stopsound
		//playsound sound\movers\misc\big_gate3.wav

	}
}

//------------------------------------------------------------------------------
//
// Lower Doors outside of Lift 1
//
//------------------------------------------------------------------------------
door02_left
{
	trigger open
	{
		wait 500
		//playsound sound\movers\misc\big_gate1.wav
		wait 400
		//playsound sound\movers\misc\big_gate2.wav looping forever
		gotomarker door02_left2 50 wait
		stopsound
		//playsound sound\movers\misc\big_gate3.wav
	}

	trigger close
	{
		wait 500
		//playsound sound\movers\misc\big_gate1.wav
		wait 400
		//playsound sound\movers\misc\big_gate2.wav looping forever
		gotomarker door02_left1 50 wait
		stopsound
		//playsound sound\movers\misc\big_gate3.wav
	}
}

door02_right
{
	trigger open
	{
		wait 500
		//playsound sound\movers\misc\big_gate1.wav
		wait 400
		//playsound sound\movers\misc\big_gate2.wav looping forever
		gotomarker door02_right2 50 wait
		stopsound
		//playsound sound\movers\misc\big_gate3.wav

	}

	trigger close
	{
		wait 500
		//playsound sound\movers\misc\big_gate1.wav
		wait 400
		//playsound sound\movers\misc\big_gate2.wav looping forever
		gotomarker door02_right1 50 wait
		stopsound
		//playsound sound\movers\misc\big_gate3.wav

	}
}